<template>
	<view>
		<map style="width: 100%; height: 100vh;" :latitude="latitude" :longitude="longitude" :markers="covers" scale="16"
			id="map1" ref="map1">
		</map>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				id: 0, // 使用 marker点击事件 需要填写id
				title: 'map',
				latitude: 27.993864,
				longitude: 120.699269,
				covers: [{
					id: 1,
					latitude: 27.993864,
					longitude: 120.699269,
					width: 32,
					height: 32,
					iconPath: '/static/sj_center_img_1.png'
				}],
				circlesData: [],
				address: "温州市",
				wxmap: null
			};
		},
		onLoad(options) {
			if (options.lat) {
				this.latitude = options.lat
				this.covers[0].latitude = options.lat
			}
			if (options.lng) {
				this.longitude = options.lng
				this.covers[0].longitude = options.lng
			}
			// console.log("this.address", this.address)
			// this.$public.geocoder(this.address).then((res) => {
			// 		console.log('addressPoint', res)
			// 		this.latitude = res.result.location.lat
			// 		this.longitude = res.result.location.lng
			// 		this.covers[0].latitude = res.result.location.lat
			// 		this.covers[0].longitude = res.result.location.lng
			// 	})
			// 	.catch((e) => {
			// 		console.log(e, '解释地址失败')
			// 	})
			// this.getDistributionList()
		},
		methods: {
			getDistributionList() {
				let that = this
				this.$public.htmlPost("/api/getDistributionList").then((res) => {
					// console.log("getDistributionList res", res)
					let data = res.data;
					if (data.code == 0) {
						console.log("scale", this.$refs.map1)
						data.data.forEach(item => {
							let itemPoint = item.bak1.replace("，", ",").split(",")
							if (itemPoint.length == 2) {
								let params = {
									latitude: itemPoint[0],
									longitude: itemPoint[1],
									radius: parseInt(item.bak3),
									fillColor: '#A3FF746A',
									color: '#54C3FF',
								}
								that.circlesData.push(params)
							}
							// console.log("that.circlesData", that.circlesData)
						})

					}
				})
			},
		}
	}
</script>

<style lang="scss" scoped>

</style>